from models import Model


class Import(Model):
    _name = 'base_import.import'

    # 不再用了
    def _import_base64(self, file_name, file_base64, file_type,
                       model, fields, columns, options, context=None):
        import_id = self.create({"res_model": model}, context=context)
        res = self.write_file(
            import_id, file_name, file_base64, file_type, context=context)

        # res = import_obj.do(import_id, fields, columns, options, dryrun=True)
        res = self.do(
            import_id, fields, columns, options, context=context)
        return res

    # def set_file(self, import_id, fp):
    #     res = self.rpc.base_import_set_file(import_id, fp)
    #     print('base_import_set_file,', res)
    #     return res

    # def do(self, import_id, fields, columns, options, dryrun=False, context=None):
    #     res = self.call('do', import_id, fields, columns, options,
    #                     dryrun=dryrun, context=context)
    #     return res
